package com.totcy.atom.presenter;

import android.content.Context;

import com.totcy.atom.bean.MMVideoResp;
import com.totcy.atom.model.MMVideoModel;
import com.totcy.atom.presenter.contract.MMVideoContract;
import com.totcy.baselibrary.base.mvpbase.BasePresenterImpl;

public class MMVideoPresenter extends BasePresenterImpl<MMVideoContract.View, MMVideoContract.Model> implements MMVideoContract.Presenter {


    public MMVideoPresenter(Context context) {
        super(context);
    }

    @Override
    public MMVideoContract.Model attachModel() {
        return new MMVideoModel(mContext);
    }

    @Override
    public void getVideoList(int pageNum) {
        if (isModelAttached()) {
            getModel().getVideoList(pageNum, new MMVideoContract.Model.DataCallback() {
                @Override
                public void onVideoList(MMVideoResp beans) {
                    if (isViewAttached()) {
                        getView().onVideoList(beans);
                    }
                }

                @Override
                public void onFail(String message) {
                    if (isViewAttached()) {
                        getView().onFail(message);
                    }
                }
            });
        }
    }
}
